Apple VRML Binary Proposal | |||
Draft 0.6 - - - April 29, 1996 | |||
Fábio Pettinati | Ronie Hecker | Pablo Fernicola | Klaus Strelau |
Header | Object 0 | Object 1 | ... | Object n | Null Object |
# | V | R | M | L | [ | d | r | a | f | t | N | ] | v | 2 | . | 0 | b | i | n | a | r | y |
# | V | R | M | L | v | 2 | . | 0 | b | i | n | a | r | y |
Control Code | Size Info | Object Content | |||||||
Type Code | unused | Size Code | |||||||
X | X | X | X | X | X | 0 | 0 | 1 byte | "size"bytes with object content |
X | X | X | X | X | X | 0 | 1 | 2 bytes | "size"bytes with object content |
X | X | X | X | X | X | 1 | 0 | 4 bytes | "size"bytes with object content |
X | X | X | X | X | X | 1 | 1 | 8 bytes | "size"bytes with object content |
Byte 0 | |||||||
f 7 | f 6 | f 5 | f 4 | f 3 | f 2 | f 1 | f 0 |
Byte 1 | Byte 0 | ||||||||||||||
f 15 | f 14 | f 13 | f 12 | f 11 | f 10 | f 9 | f 8 | f 7 | f 6 | f 5 | f 4 | f 3 | f 2 | f 1 | f 0 |
Byte 2 | Byte 1 | Byte 0 | |||||||||||||||||||||
f 23 | f 22 | f 21 | f 20 | f 19 | f 18 | f 17 | f 16 | f 15 | f 14 | f 13 | f 12 | f 11 | f 10 | f 9 | f 8 | f 7 | f 6 | f 5 | f 4 | f 3 | f 2 | f 1 | f 0 |
Byte 3 | Byte 2 | Byte 1 | Byte 0 | ||||||||||||||
f 31 | f 30 | f 29 | f 28 | f 27 | f 26 | f 25 | f 24 | ... | ... | f 7 | f 6 | f 5 | f 4 | f 3 | f 2 | f 1 | f 0 |
Byte 0 | |||||||
0 | 0 | X | X | X | X | X | X |
Byte 1 | Byte 0 | ||||||||||||||
0 | 1 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
Byte 3 | Byte 2 | Byte 1 | Byte 0 | ||||||||||||||
1 | 0 | X | X | X | X | X | X | ... | ... | X | X | X | X | X | X | X | X |
Byte 7 | Byte 6 | Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 | Byte 0 | ||||||||||||||
1 | 1 | X | X | X | X | X | X | ... | ... | ... | ... | ... | ... | X | X | X | X | X | X | X | X |
Code | Field Type | Size (bytes) | Values |
---|---|---|---|
0x00 | SFBool | 1 | 0x00 or 0x01 |
0x01 | SFColor | 2 to 12 | RGB color information |
0x02 | SFFloat | 4 | IEEE single-precision floating point value |
0x03 | SFImage | Variable | Image data |
0x04 | SFInt32 | 4 | value in [-2**32 , 2**31] |
0x05 | SFNode | Variable | Node control code and associated data |
0x06 | SFRotation | 4 to 16 | rotation axis and angle information |
0x07 | SFString | Variable | String contents in UTF-8 format |
0x08 | SFTime | 8 | IEEE double-precision floating point value |
0x09 | SFVec2f | 8 | 2 IEEE single-precision floating point values |
0x0A | SFVec3f | 2 to 12 | 3 IEEE single-precision floating point values |
0x81 | MFColor | n * 2 to n * 12 | Multiple SFColor values |
0x82 | MFFloat | n * 4 | Multiple SFFloat values |
0x84 | MFInt32 | n * 4 | Multiple SFInt32 values |
0x85 | MFNode | Variable | Multiple SFNode values |
0x86 | MFRotation | n * 4 to n * 16 | Multiple SFRotation |
0x87 | MFString | Variable | Multiple SFString values |
0x88 | MFTime | n * 8 | Multiple SFTime values |
0x89 | MFVec2f | n * 8 | Multiple SFVec2f values |
0x8A | MFVec3f | n * 2 to n * 12 | Multiple SFVec3f values |
Built-in Node Code | String Value | |
---|---|---|
Dec | Hex | |
0 | 0x00 | Anchor |
1 | 0x01 | Appearance |
2 | 0x02 | AudioClip |
3 | 0x03 | Background |
4 | 0x04 | Billboard |
5 | 0x05 | Box |
6 | 0x06 | Collision |
7 | 0x07 | Color |
8 | 0x08 | ColorInterpolator |
9 | 0x09 | Cone |
10 | 0x0A | Coordinate |
11 | 0x0B | CoordinateInterpolator |
12 | 0x0C | Cylinder |
13 | 0x0D | CylinderSensor |
14 | 0x0E | DirectionalLight |
15 | 0x0F | DiskSensor |
16 | 0x10 | ElevationGrid |
17 | 0x11 | Fog |
18 | 0x12 | FontStyle |
19 | 0x13 | Extrusion |
20 | 0x14 | Group |
21 | 0x15 | ImageTexture |
22 | 0x16 | IndexedFaceSet |
23 | 0x17 | IndexedLineSet |
24 | 0x18 | IndexInterpolator |
25 | 0x19 | Inline |
26 | 0x1A | LOD |
27 | 0x1B | Material |
28 | 0x1C | MovieTexture |
29 | 0x1D | NavigationInfo |
30 | 0x1E | Normal |
31 | 0x1F | NormalInterpolator |
32 | 0x20 | OrientationInterpolator |
33 | 0X21 | PixelTexture |
34 | 0x22 | PlaneSensor |
35 | 0x23 | PointLight |
36 | 0x24 | PointSet |
37 | 0x25 | PositionInterpolator |
38 | 0x26 | ProximitySensor |
39 | 0x27 | ScalarInterpolator |
40 | 0x28 | Script |
41 | 0x29 | Shape |
42 | 0x2A | Sound |
43 | 0x2B | Sphere |
44 | 0x2C | SphereSensor |
45 | 0x2D | SpotLight |
46 | 0x2E | Switch |
47 | 0x2F | Text |
48 | 0x30 | TextureTransform |
49 | 0x31 | TextureCoordinate |
50 | 0x32 | TimeSensor |
51 | 0x33 | TouchSensor |
52 | 0x34 | Transform |
53 | 0x35 | Viewpoint |
54 | 0x36 | WorldInfo |
55 | 0x37 | RESERVED for future use |
56 | 0x38 | RESERVED for future use |
57 | 0x39 | RESERVED for future use |
58 | 0x3A | RESERVED for future use |
59 | 0x3B | RESERVED for future use |
60 | 0x3C | RESERVED for future use |
61 | 0x3D | RESERVED for future use |
62 | 0x3E | RESERVED for future use |
63 | 0x3F | RESERVED for future use |
Here is an example of how a parser would read a four-byte long signed integer on a little-endian system:char *ParseLong(char *inBytes, long *theValue) { *theValue = (inBytes[0] << 24) | (inBytes[1] << 16) | (inBytes[2] << 8) | (inBytes[3] << 0); return (inBytes + 4); }
char *ParseLong(char *inBytes, long *theValue) { *theValue = (inBytes[0] << 0) | (inBytes[1] << 8) | (inBytes[2] << 16) | (inBytes[3] << 24); return (inBytes + 4); }
Control Code | |
---|---|
0x0 | 0x0 |
Control Code | Size Info | Num Fields | Field Index | Compr. | ... | ... | ... | Field Index | Compr. | |
---|---|---|---|---|---|---|---|---|---|---|
0x1 | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
Index | Field Description | Compression Scheme | Compression Description |
---|---|---|---|
0 | Normalized value in [0, 1] | 0 | Uncompressed (4 bytes) |
1 | [0, 65535] (2 bytes) | ||
2 | [0, 255] (1 byte) | ||
1 | SFColor | 0 | Uncompressed (12 bytes) |
1 | R-G-B -> 8-8-8 (3 bytes) | ||
2 | R-G-B -> 5-5-5 (2 bytes) | ||
2 | Normalized SFVec3f | 0 | Uncompressed (12 bytes) |
1 | 0aaabbccddeeffgg...kk (3 bytes) | ||
2 | 0aaabbccddeeffgg (2 bytes) | ||
3 | Rotation (axis + angle) | 0 | Uncompressed (16 bytes) |
1 | 3-byte axis + 2-byte angle | ||
2 | 2-byte axis + 2-byte angle |
Control Code | Size Info | Node Index | Field Mask Info | Node Fields | |
---|---|---|---|---|---|
0x2 | ... | ... | ... | ... | Node fields description |
Built-in Node: | DirectionalLight |
Index into Built-In Node Table: | 14 (0x0E) |
Field # | Type | Name |
0 | SFBool | on |
1 | SFFloat | intensity |
2 | SFFloat | ambientIntensity |
3 | SFColor | color |
4 | SFVec3f | direction |
DirectionalLight { }
Byte # Content Description 0 0x21 built-in node, 1 byte index 1 3 number of bytes remaining in the object 2 0x0E index for DirectionalLight 3 1 field mask size 4 0x00 mask: no fields present
DirectionalLight { color 1 0 0 intensity 0.6 }
The same DirectionalLight could be represented using compressed fields. Imagining that the intensity value could be mapped to a integer in the [0, 255] range (one byte), and that the color could be mapped to a 16-bit value in 5-5-5 format, here is how that object could be represented:
Byte # Content Description 0 0x21 built-in node, 1 byte index 1 19 number of bytes remaining in the object 2 0x0E index for DirectionalLight 3 1 field mask size 4 0x0A mask: fields 1, 3 present 5-8 0.6 intensity value, uncompressed 9-12 1.0 R color component, uncompressed 13-16 0.0 G color component, uncompressed 17-20 0.0 B color component, uncompressed
Byte # Content Description 0 0x21 built-in node, 1 byte index 1 6 number of bytes remaining in the object 2 0x0E index for DirectionalLight 3 1 field mask size 4 0x0A mask: fields 1, 3 present 5 153 intensity value, compressed 6-7 0x7C00 color, compressed
DirectionalLight { on TRUE direction 0.433 0.75 0.5 ambientIntensity 0.6 }
The same DirectionalLight could be represented using compressed fields. Imagining that the intensity value could be mapped to a integer in the [0, 255] range (one byte), and that the direction vector could be mapped to a 16-bit value, here is how that object could be represented:
Byte # Content Description 0 0x21 built-in node, 1 byte index 1 20 number of bytes remaining in the object 2 0x0E index for DirectionalLight 3 1 field mask size 4 0x15 mask: fields 0, 2, 4 present 5 0x01 TRUE value 6-9 0.6 intensity value, uncompressed 10-13 0.0 x vector component, uncompressed 14-17 0.0 y vector component, uncompressed 18-21 0.0 z vector component, uncompressed
Byte # Content Description 0 0x21 built-in node, 1 byte index 1 7 number of bytes remaining in the object 2 0x0E index for DirectionalLight 3 1 field mask size 4 0x15 mask: fields 0, 2, 4 present 5 0x01 TRUE value 6 153 intensity value, compressed 7-8 0xXXXX vector, compressed
Control Code | Size Info | Index Info | Length info | String | |||
---|---|---|---|---|---|---|---|
0x8 | ... | ... | ... | ... | ... | ... | UTF-8 data |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |
Control Code | Size Info | Object Contents | |
---|---|---|---|
0xX | ... | ... | Contents description |